#
# define compiler and compiler flag variables
#

JFLAGS = -g -nowarn
JC = javac
LIBDIR = ./lib/junit.jar:./lib/filterbuilder.jar:./lib/htmllexer.jar:./lib/htmlparser.jar:./lib/junit.jar:./lib/sax2.jar:./lib/thumbelina.jar:./lib/swing-layout-1.0.jar:./lib/lookandfeel/nimrodlf-1.0e.jar:./lib/lookandfeel/lipstikLF-1.1.jar:./lib/lookandfeel/tinylaf-1_3_8/tinylaf.jar:./lib/lookandfeel/tinylaf-1_3_8:
CLASSDIR = target
RESOURCES = resources
DATA = data
CP = cp
MKDIR = mkdir


#
# Clear any default targets for building .class files from .java files; we 
# will provide our own target entry to do this in this makefile.
# make has a set of default targets for different suffixes (like .c.o) 
# Currently, clearing the default for .java.class is not necessary since 
# make does not have a definition for this target, but later versions of 
# make may, so it doesn't hurt to make sure that we clear any default 
# definitions for these
#
.SUFFIXES: .java .class


#
# Here is our target entry for creating .class files from .java files 
# This is a target entry that uses the suffix rule syntax:
#	DSTS:
#		rule
#  'TS' is the suffix of the target file, 'DS' is the suffix of the dependency 
#  file, and 'rule'  is the rule for building a target	
# '$*' is a built-in macro that gets the basename of the current target 
# Remember that there must be a < tab > before the command line ('rule') 
#

#.java.class:
#	$(JC) $(JFLAGS) -cp $(LIBDIR) -d $(CLASSDIR) $*.java
#$(CLASSES)
#
# CLASSES is a macro consisting of 4 words (one for each java source file)
#

CLASSES = \
	ar/com/marotte/btreeplus/exception/BTreePlusException.java \
	ar/com/marotte/btreeplus/exception/BTreePlusConfException.java \
	ar/com/marotte/serializer/PrimitiveTypeSerializer.java \
	ar/com/marotte/serializer/HydrateInfo.java \
	ar/com/marotte/serializer/Serializer.java \
	ar/com/marotte/serializer/common/ByteSerializer.java \
	ar/com/marotte/serializer/common/BooleanSerializer.java \
	ar/com/marotte/serializer/common/CharacterSerializer.java \
	ar/com/marotte/serializer/common/FloatSerializer.java \
	ar/com/marotte/serializer/common/LongSerializer.java \
	ar/com/marotte/serializer/common/StringSerializerDelimiter.java \
	ar/com/marotte/serializer/common/DoubleSerializer.java \
	ar/com/marotte/serializer/common/StringSerializerSize.java \
	ar/com/marotte/serializer/common/ShortSerializer.java \
	ar/com/marotte/serializer/common/IntegerSerializer.java \
	ar/com/marotte/serializer/common/SerializerCache.java \
	ar/com/marotte/implementation/util/Bits.java \
	ar/com/marotte/parser/SaveFile.java \
	ar/com/marotte/parser/TextFileIn.java \
	ar/com/marotte/parser/CleanWord.java \
	ar/com/marotte/parser/ParserHtml.java \
	ar/com/marotte/btreeplus/elements/Key.java \
	ar/com/marotte/btreeplus/elements/Element.java \
	ar/com/marotte/btreeplus/node/ChainedNode.java \
	ar/com/marotte/btreeplus/conf/BTreePlusConfiguration.java \
	ar/com/marotte/btreeplus/BTreePlus.java \
	ar/com/marotte/btreeplus/node/Node.java \
	ar/com/marotte/btreeplus/node/AbstractLeafNode.java \
	ar/com/marotte/btreeplus/node/AbstractInternalNode.java \
	ar/com/marotte/test/implementation/ImplementationTest.java \
	ar/com/marotte/test/btreeplus/memory/elements/TestKey.java \
	ar/com/marotte/test/btreeplus/memory/elements/TestElement.java \
	ar/com/marotte/test/btreeplus/memory/TestBTreePlusMemory.java \
	ar/com/marotte/test/btreeplus/disk/elements/TestKey.java \
	ar/com/marotte/test/btreeplus/disk/elements/ListTestKeySerializer.java \
	ar/com/marotte/test/btreeplus/disk/elements/TestElementAndTestKeyListSerializerFactory.java \
	ar/com/marotte/test/btreeplus/disk/elements/TestElement.java \
	ar/com/marotte/test/btreeplus/disk/elements/ListTestElementSerializer.java \
	ar/com/marotte/test/btreeplus/disk/TestBTreePlusDisk.java \
	ar/com/marotte/test/serializer/TestSerializer.java \
	ar/com/marotte/test/serializer/TestSerializadorSebastian.java \
	ar/com/marotte/test/ExtendedTestCase.java \
	ar/com/marotte/implementation/elements/ImplementationElementAndImplementationKeyListSerializerFactory.java \
	ar/com/marotte/implementation/elements/ImplementationElement.java \
	ar/com/marotte/implementation/elements/ListImplementationKeySerializer.java \
	ar/com/marotte/implementation/elements/ListImplementationElementSerializer.java \
	ar/com/marotte/implementation/elements/ArchivoListasDocumentos.java \
	ar/com/marotte/implementation/elements/ImplementationKey.java \
	ar/com/marotte/implementation/compresion/CompresionDelta.java \
	ar/com/marotte/btreeplus/BTreePlusFactory.java \
	ar/com/marotte/btreeplus/node/NodeReference.java \
	ar/com/marotte/btreeplus/node/KeyNodeReference.java \
	ar/com/marotte/btreeplus/conf/BTreePlusNodeFactory.java \
	ar/com/marotte/btreeplus/conf/AdministrativeBTreePlus.java \
	ar/com/marotte/btreeplus/impl/memory/BTreePlusConfigurationMemory.java \
	ar/com/marotte/btreeplus/impl/memory/BTreePlusNodeMemoryFactory.java \
	ar/com/marotte/btreeplus/impl/memory/node/LeafNodeMemory.java \
	ar/com/marotte/btreeplus/impl/memory/node/NodeReferenceMemory.java \
	ar/com/marotte/btreeplus/impl/memory/node/InternalNodeMemory.java \
	ar/com/marotte/btreeplus/impl/memory/AdministrativeBTreePlusMemory.java \
	ar/com/marotte/btreeplus/impl/disk/ElementAndKeyListSerializerFactory.java \
	ar/com/marotte/btreeplus/impl/disk/BTreePlusConfigurationDisk.java \
	ar/com/marotte/btreeplus/impl/disk/serializer/InternalNodeSerializer.java \
	ar/com/marotte/btreeplus/impl/disk/serializer/LeafNodeSerializer.java \
	ar/com/marotte/btreeplus/impl/disk/serializer/NodeReferenceDiskSerializer.java \
	ar/com/marotte/btreeplus/impl/disk/file/NodeFileManager.java \
	ar/com/marotte/btreeplus/impl/disk/file/AdministrativeBTreePlusDisk.java \
	ar/com/marotte/btreeplus/impl/disk/file/InternalNodeFileManager.java \
	ar/com/marotte/btreeplus/impl/disk/file/LeafNodeFileManager.java \
	ar/com/marotte/btreeplus/impl/disk/node/DiskNode.java \
	ar/com/marotte/btreeplus/impl/disk/node/InternalNodeDisk.java \
	ar/com/marotte/btreeplus/impl/disk/node/LeafNodeDisk.java \
	ar/com/marotte/btreeplus/impl/disk/node/NodeReferenceDisk.java \
	ar/com/marotte/btreeplus/impl/disk/BTreePlusNodeDiskFactory.java \
	ar/com/marotte/util/RelativePath.java \
	ar/com/marotte/main/MainBTreePlus.java \
	ar/com/marotte/hash/Hash.java \
	ar/com/marotte/hash/TestHashing.java \
	ar/com/marotte/signatureFile/SignatureFile.java \
	ar/com/marotte/signatureFile/SignatureFileManager.java \
	ar/com/marotte/signatureFile/SignatureFileConfig.java \
	ar/com/marotte/main/MainSignatureFiles.java \
	ar/com/marotte/logica/arbolbinario/ArbolBinario.java \
	ar/com/marotte/logica/arbolbinario/Nodo.java \
	ar/com/marotte/logica/ConsultaLogica.java \
	ar/com/marotte/logica/Controlador.java \
	ar/com/marotte/logica/Historial.java \
	ar/com/marotte/interfaz/menu/MenuBarra.java \
	ar/com/marotte/interfaz/menu/MenuItem.java \
	ar/com/marotte/interfaz/menu/Menu.java \
	ar/com/marotte/interfaz/menuAyuda/VentanaAcercaDe.java \
	ar/com/marotte/interfaz/menuBuscar/VentanaBusquedaLogica.java \
	ar/com/marotte/interfaz/menuBuscar/VentanaResultado.java \
	ar/com/marotte/interfaz/menuBuscar/VentanaVerDocumento.java \
	ar/com/marotte/interfaz/menuBuscar/VentanaVerResultado.java \
	ar/com/marotte/interfaz/menuComparar/VentanaVerHistorial.java \
	ar/com/marotte/interfaz/menuEdicion/VentanaConfigSignatureFile.java \
	ar/com/marotte/interfaz/menuIndexar/hiloProcesar.java \
	ar/com/marotte/interfaz/menuIndexar/VentanaIndexarDirectorio.java \
	ar/com/marotte/interfaz/menuIndexar/VentanaIndexarDocumento.java \
	ar/com/marotte/interfaz/menuIndexar/VentanaProceso.java \
	ar/com/marotte/interfaz/VentanaMenu.java \
	ar/com/marotte/interfaz/VentanaPrincipal.java

#
# the default make target entry
#

default: classes


#
# This target entry uses Suffix Replacement within a macro: 
# $(name:string1=string2)
# 	In the words in the macro named 'name' replace 'string1' with 'string2'
# Below we are replacing the suffix .java of all words in the macro CLASSES 
# with the .class suffix
#

classes: 
	$(JC) $(JFLAGS) -cp $(LIBDIR) -d $(CLASSDIR) $(CLASSES) ; \
	$(CP) -R $(RESOURCES) $(CLASSDIR) ; \
	$(MKDIR) -p $(CLASSDIR)/$(DATA) ; \
	$(CP) -R ./lib $(CLASSDIR) ; \
	$(CP) -R ./imagenes $(CLASSDIR)

run:
	cd target; \
	java -cp $(LIBDIR) ar.com.marotte.logica.Controlador

#btp:
#	cd target; \
#	java -cp $(LIBDIR) ar.com.marotte.main.MainBTreePlus

#sf:
#	cd target; \
#	java -cp $(LIBDIR) ar.com.marotte.main.MainSignatureFiles

#$(CLASSES:.java=.class)


#
# RM is a predefined macro in make (RM = rm -f)
#

clean:
	$(RM) -Rf $(CLASSDIR)/*

